feat(models): migrate Models APIs to typed NemoClient - #803
Draft
maxdubrinsky wants to merge 10 commits into
Draft
feat(models): migrate Models APIs to typed NemoClient#803maxdubrinsky wants to merge 10 commits into
maxdubrinsky wants to merge 10 commits into
Conversation
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Contributor
|
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Main dropped the legacy docker and k8s-nim-operator backends (#705) and replaced the reconcilers' per-entity Model Entity reads and writes with ModelEntityCache (#953, #951). The branch's changes to the deleted backends were import rewrites, so they go with the files. Everywhere the cache supersedes a direct read/write, main's semantics win and the calls it makes are routed through the typed client. ModelEntityCache arrived on main built on the umbrella SDK, which left models_controller holding a dangling self._models_sdk after the merge. It is migrated to AsyncModelsClient here, since leaving it on the SDK would make the branch's premise only half true. _load_virtual_models still reached for self._models_sdk. Its bare except Exception reported the AttributeError as a VirtualModel listing failure and skipped orphan cleanup, so the tests stayed green while the cleanup silently never ran. VirtualModel work stays on the umbrella SDK: it is an inference-gateway resource, not a Models one. The SDK exception types are aliased to say so. Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
…odels-to-nemoclient/md
Every test added here was checked by mutation: reverting the behaviour it describes fails that test and only that test. Model Entity cache. The migration moved writes behind request bodies and responses behind .data(), and nothing asserted either. Dropping .data() or the write-back into the snapshot left the suite green, while in production it would cost a create/409 round trip for the second change to an entity in a phase. The create body also never carried staged field updates in any test, though that is the only shape the provider reconciler produces. VirtualModel cleanup. VirtualModel.name is optional on the wire, and the guard for it was the untested one of the pair; without it the delete goes out as name=None. _retrieve_model_entity. The cache branch is what runs in production, since the cache is refreshed at the start of every phase, yet only the direct fetch was covered, and then only because those tests never run a phase. A miss now reports the entity as absent with no fallback, which is worth stating outright. known_deployment_ids skips contexts with no deployment. That was a merge resolution, and reading it unguarded stalls the controller on every tick rather than degrading one pass. _load_virtual_models catches APIError rather than Exception. "The listing failed" should mean the service, not a bug in this method; catching everything is what let an AttributeError disable orphan cleanup silently. method() had no test at all for class-level access, which is what Mock(spec=...) and every introspection tool performs. Its dynamic attributes are now declared on the descriptor, and the comment no longer claims inspect.signature resolves through __wrapped__, because it does not: signature() refuses a non-callable before it looks. make_models_client keyed off name prefixes, which made the three sync OpenAI route builders awaitable and gave the two unpaginated list endpoints a paginated response. It now reads the method() descriptors and their declared return types. Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/modelsresource implementation while preserving existing URL helpers, polling behavior, pagination, conflict handling, and delete status visibility; sync its vendored package copy without regenerating Stainless.client_from_platform, including explicit retry headers, 408/409/429, server errors, and reasonable Retry-After values, without changing standalone NemoClient defaults.Validation
nemo-unslothplugin tests passed against typed Models/Files mocks.ty, vendored-SDK/CLI sync lints, negative Stainless searches, warning-strict controller checks, andgit diff --checkpassed.Intentional boundaries
Follow-up
Directly owned
NemoClienttransport teardown is tracked separately in AIRCORE-933.Linear: https://linear.app/nvidia/issue/AIRCORE-876